<template>
<div class="demo1">
  <h2>我是Demo1组件:{{number}}</h2>
</div>
</template>

<script>
export default {
  name: "Demo1",
  data(){
    return{
      number:''
    }
  },
  methods:{
    gnumber(n){
      this.number=n
    }
  },
  mounted() {
    this.$bus.$on('getNumber',this.gnumber)
  }
}
</script>

<style scoped>
.demo1{
  background: aqua;
  padding: 10px;
}
</style>